{% extends "enterprise/base.html" %}
{% block content %}
            <script type="text/javascript">
                var primary_menu = "menu_0";
                var sub_menu = "menu_0_2";
            </script>
            <div class="col-md-12">
                <!-- <div class="panel panel-primary">
                    <div class="panel-heading">
                        <div class="panel-title"><h3>周边水和大气环境保护目标信息</h3></div>
                    </div>
                </div> -->
             <form method="post" enctype="application/x-www-form-urlencoded" class="formSubmit">    
               <div class="panel panel-primary">
                    <div class="panel-heading">
                        <div class="panel-title"><h3>一、水环境保护目标信息<span style="font-size:12px;color:red;font-weight:normal"> （填写企业周边2.5Km范围内和企业废水最终排污点上游2.5Km、下游5km范围内水环境保护目标）</span></h3></div>
                    </div>
                    <div class="panel-body with-table">

                    
                    <table class="input_in table-detail">
                    <tr>
                        <th width=200>周边是否存在水环境保护目标</th>
{#                        {%if water.water_exist%}#}
                        <td colspan=5>
                            <input type="radio" name="water_exist" checked="checked" value="1">是 &nbsp;&nbsp;&nbsp;&nbsp;
                            <input type="radio" value="0" name="water_exist">否
                        </td>
{#                        {%else%}#}
{#                        <td colspan=5>#}
{#                            <input type="radio" name="water_exist" value="1">#}
{#                            是 &nbsp;&nbsp;&nbsp;&nbsp; <input  checked="checked" type="radio" value="0" name="water_exist">否</td>#}
{#                        {% endif %}#}
                    </tr>
                    <tr>
                        <th>序号</th>
                        <th>水环境保护目标名称</th>
                        <th>方位</th>
                        <th>距离厂界距离（米）</th>
                        <th>环境质量功能类别</th>
                        <th>操作</th>
                    </tr>
                    {%if details%}
                    {%for detail in details%}
                     <tr class="rowT">
                         <td>{{forloop.counter}}</td>
                         <td><input datatype="*" type="text" name="water_name" value="{{detail.water_name}}"  placeholder="请输入" datatype="*"></td>
                         <td><input datatype="*" type="text"  name="water_code" value="{{detail.water_scale}}"  placeholder="请输入" datatype="*"></td>
                         
                         <td><input datatype="*" type="text"  name="water_distance" value="{{detail.water_distance}}"  placeholder="请输入" datatype="n"></td>
                         <td><input datatype="*" type="text"  name="water_scale" value="{{detail.water_code}}"  placeholder="请输入" datatype="*"></td>
                         {%if forloop.counter == 1%}
                         <td width=60><input type="button" value="添加" class="btn btn-success" onclick="addSortFile(this)"></td>
                         {%else%}
                         <td width=60><input type="button" value="删除" class="btn btn-danger" onclick="delSortFile(this)"></td>
                         {% endif %}
                     </tr>
                     {% endfor %}
                     {%else%}
                     <tr class="rowT">
                         <td>1</td>
                         <td><input datatype="*" type="text" name="water_name" placeholder="请输入" datatype="*"></td>
                         <td><input datatype="*" type="text"  name="water_code"  placeholder="请输入" datatype="*"></td>
                         <td><input datatype="*" type="text"  name="water_scale"  placeholder="请输入" datatype="*"></td>
                         <td><input datatype="*" type="text"  name="water_distance"  placeholder="请输入" datatype="n"></td>
                         <td width=60><input type="button" value="添加" class="btn btn-success" onclick="addSortFile(this)"></td>
                     </tr>
                     {% endif %}
                    <tr>
                        <td width="40">备注</td>
                        <td colspan=5><textarea  name="water_remark" rows=4 placeholder="请输入">{{water.water_remark}}</textarea></td>
                    </tr>
                    </table>

                    </div>
                </div>
                
                 <div class="buttons">
			        <input onclick="submitSave()" type="submit" class="btn btn-orange btn-lg" value="暂存">
                    <input type="submit" class="btn btn-success btn-lg" value="确认">
			        <input class="btn btn-info btn-lg" type="reset" value="重置"/>
			    </div>
			    
			     </form>
            </div>


{% endblock %}

{% block js %}
<script type="text/javascript">
    $(function(){
        var flag = $("input[name='water_exist']:checked").val();
        if (flag==1) {
            $(".rowT").show();
            $("table tr").eq(1).show();
            $(".rowT").find("input").attr("datatype","*");
        }else{
            $(".rowT").hide();
            $("table tr").eq(1).hide();
            $(".rowT").hide().find("input").removeAttr('datatype');
        }
        $("input[name='water_exist']").click(function(){
            var flag = $("input[name='water_exist']:checked").val();
            if (flag==1) {
                $(".rowT").show();
                $("table tr").eq(1).show();
                $(".rowT").find("input").attr("datatype","*");
            }else{
                $(".rowT").hide();
                $("table tr").eq(1).hide();
                $(".rowT").hide().find("input").removeAttr('datatype');
            }
        })
        
    });
</script>
{% endblock %}